Skip to content

Conversation

abdul99ahad
Copy link

@abdul99ahad abdul99ahad commented Jul 30, 2025

Closes #181

Proposed Changes

Value less hidden property are marked as deprecated

image

I’ve added the test case, but just to note: this scenario won’t trigger an error, only a deprecation warning. Currently, I’m not sure how to capture or assert against deprecation warnings through the existing validation mechanism.

Test setup to catch warnings is added

Steps to try out:

You can validate the template using element template validator validateZeebe

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Jul 30, 2025
@abdul99ahad abdul99ahad requested review from barmac, a team and Buckwich and removed request for a team July 30, 2025 10:20
@abdul99ahad abdul99ahad marked this pull request as draft July 30, 2025 10:21
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Jul 30, 2025
@abdul99ahad abdul99ahad marked this pull request as ready for review July 30, 2025 15:30
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Jul 30, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing a test verifying that the new behavior works. We'd need a new test pattern for this though.

Comment on lines 638 to 668
"then": {
"anyOf": [
{ "required": [ "value" ] },
{ "required": [ "generatedValue" ] },
{
"not": {
"anyOf": [
{ "required": [ "value" ] },
{ "required": [ "generatedValue" ] }
]
},
"deprecated": true
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if we can get away with a strict validation error, as suggested in #181 (comment)? What were the results? That could simplify https://github.com/camunda/element-templates-json-schema/pull/187/files#r2244641698 as we'd not need to test for warnings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we did check. There are alot of connectors with value-less hidden properties which results in failed integration tests.
For e.g, Amazon SQS Outbound Connector

      {
        "id": "configuration.endpoint",
        "label": "Endpoint",
        "description": "Specify endpoint if need to use custom endpoint",
        "optional": true,
        "group": "configuration",
        "binding": {
          "name": "configuration.endpoint",
          "type": "zeebe:input"
        },
        "type": "Hidden"
      },

You can check by removing this block from the properties.json which marks value-less property as deprecated.

            {
              "not": {
                "anyOf": [
                  { "required": [ "value" ] },
                  { "required": [ "generatedValue" ] }
                ]
              },
              "deprecated": true
            }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you let the Connectors team know about them? You can use the #ask-connectors-team channel for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bottom-line is that we rather mark the properties as deprecated as we don't want to introduce a BC.

@abdul99ahad abdul99ahad changed the title Value less hidden property are marked as deprecated Value less hidden property are not allowed Jul 31, 2025
@abdul99ahad abdul99ahad changed the title Value less hidden property are not allowed Value less hidden properties are not allowed Jul 31, 2025
@abdul99ahad abdul99ahad marked this pull request as draft August 4, 2025 14:51
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Aug 4, 2025
@nikku
Copy link
Member

nikku commented Aug 15, 2025

@abdul99ahad This looks amazing! From what I can see:

  • We now have an additional layer of validation, for situations marked as deprecated.
  • During validation we can pick up such properties, and i.e. turn them into schema warnings and or problems in the problems panel.

I'd consider if/how we could use stock deprecation support in the schema (https://json-schema.org/draft/2020-12/json-schema-validation#section-9.3) over writing our own implementation.

@abdul99ahad
Copy link
Author

I'd consider if/how we could use stock deprecation support in the schema (https://json-schema.org/draft/2020-12/json-schema-validation#section-9.3) over writing our own implementation.

That's doable, the only downside is to check for warnings ,we can't integrate it with ajv validator but have to rely on recursively checking the schema after the validation to warn the user.

@abdul99ahad
Copy link
Author

abdul99ahad commented Aug 18, 2025

I explored the stock deprecated: true support as suggested instead of using the isDeprecated keyword we introduced earlier.

However, using the stock approach complicates warning users. Since deprecated is purely metadata, there’s no built-in mechanism in AJV to emit warnings, so what we needed was to recursively walk the schema ourselves. The main issue with this is we lose context: we end up getting warnings for all deprecated fields across the schema, not just the ones used in the current template being validated.

In contrast, our isDeprecated keyword allowed us to precisely warn only for properties actually present in the template under validation, without needing to do a full tree walk.

In my opinion, introducing a custom keyword like isDeprecated to explicitly mark deprecated properties makes more sense for our use case, it keeps validation scoped and predictable. We already have custom errors support, so adding custom warning doesn't deviate from current pattern.

Happy to discuss alternatives or hybrid approaches if needed.

@abdul99ahad abdul99ahad force-pushed the 181-hidden-props branch 2 times, most recently from 79efc13 to 45e1140 Compare August 19, 2025 15:01
@abdul99ahad abdul99ahad marked this pull request as ready for review August 19, 2025 15:10
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Aug 19, 2025
@nikku
Copy link
Member

nikku commented Sep 18, 2025

@barmac this PR needs a new owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Review pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hidden property without value is allowed in the schema
3 participants